package com.xoa.util.cms.directive;

import com.xoa.dao.portalColumn.PortalColumnMapper;
import com.xoa.util.common.StringUtils;
import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

public class CMSPageDirective implements TemplateDirectiveModel {
    @Override
    public void execute(Environment environment, Map map, TemplateModel[] templateModels, TemplateDirectiveBody templateDirectiveBody) throws TemplateException, IOException {
        //获取标签的id属性值
        String column = StringUtils.getString(map.get("id"));

        Writer write = environment.getOut();

        //获取参数中的页码数
        int curPage = StringUtils.getInteger(environment.getCustomAttribute("curPage"),1);
        int pageNums = StringUtils.getInteger(environment.getCustomAttribute("pageNums"),0);

        //是否是预览模式
        boolean preview = (boolean) environment.getCustomAttribute("preview");

        String currentClass = StringUtils.getString(map.get("currentClass"));
        String disableDClass = StringUtils.getString(map.get("disabledClass"));


        PortalColumnMapper portalColumnMapper = (PortalColumnMapper) environment.getCustomAttribute("portalColumnMapper");
    }
}
